#include "cx_log.h"
#include "stdarg.h"

#define MAX_ONE_LOG_LEN 4096

QVOID cx_log_to_file(CXFILE file, QCHAR* format, ...)
	{
	QCHAR log_buf[MAX_ONE_LOG_LEN] = {0};
	QCHAR format_buf[1024] = {0};
	va_list arg_list;
	
	if (format == QNULL)
		return;
	
	snprintf( format_buf, 1024-1, "%s", format );
	va_start( arg_list, format );
	vsnprintf( log_buf, MAX_ONE_LOG_LEN-1, format_buf, arg_list );
	va_end( arg_list );
	
    if ( cx_file_isValid ( file ) )
    	{
    	cx_file_write( file, log_buf, MAX_ONE_LOG_LEN );
    	}
	
	}
